[KDA] Add TLE inference backend for NVIDIA H800 with up to 1.41x speedup - #1075
[KDA] Add TLE inference backend for NVIDIA H800 with up to 1.41x speedup#1075kuoihao wants to merge 2 commits into
Conversation
|
Sorry for the late response. My main concern is maintenance cost over time. TileLang is still a moving target: a compiler version bump can turn into compile errors or, worse, silent numerical errors. Meanwhile the Triton baseline for KDA is still evolving quickly, so a parallel TLE implementation risks going stale and drifting out of sync with the reference path. Before we take on a second backend to maintain, could you share how you see this staying correct over time — e.g. is there test/CI coverage that would catch drift from the Triton baseline, and how tightly does the TLE version track it? |
|
Thanks for the review. I understand that TileLang was mentioned as an example of the long-term maintenance and compiler-upgrade risks involved. This PR already includes reproducible TLE correctness and performance commands: Performance: # TLE
FLA_TLE_KDA=1 FLA_FLASH_KDA=0 FLA_TILELANG=0 \
python -m benchmarks.ops.run \
--op chunk_kda_inference --modes fwd
# FlashKDA
FLA_TLE_KDA=0 FLA_FLASH_KDA=1 FLA_TILELANG=0 \
python -m benchmarks.ops.run \
--op chunk_kda_inference --modes fwdCorrectness: python -m pytest tests/ops/test_kda.py -k 'tle_kda' -vTo continuously catch compilation, numerical, or performance regressions caused by changes in the Triton baseline or FlagTree upgrades, I can integrate these commands into the existing H100 CI and pin it to the validated Would you prefer me to add dedicated TLE correctness and performance CI coverage in this PR? If this direction sounds appropriate, I will follow up with the detailed CI design and local validation results in my next update. |
Summary
This PR adds a Triton TLE inference backend for
chunk_kda.It uses the existing
fla.ops.kda.chunk_kdaentry point and is selected through backend dispatch. TLE has higher priority than FlashKDA; unsupported inputs automatically fall back to FlashKDA or the default Triton implementation.Main changes:
FLA_TLE_KDA=0to opt out.Implementation and optimization analysis:
https://mp.weixin.qq.com/s/0KUi9436u9AhzpuBqB_Xww
flagtree:
https://github.com/flagos-ai/FlagTree
install:
Requirements
torch.inference_mode()K = V = 128use_qk_l2norm_in_kernel=Trueuse_gate_in_kernel=Trueuse_beta_sigmoid_in_kernel=Truesafe_gate=Truestate_v_first=TruePerformance
Environment: NVIDIA H800, CUDA 13.0, PyTorch 2.13.0+cu130.
TLE is 1.36x–1.41x faster than FlashKDA on the tested shapes.
Correctness
All TLE tests passed:
python -m pytest tests/ops/test_kda.py -k 'tle_kda' -v